package org.gy.T10.t1;

public class MyThread extends Thread{
    public MyThread(String name) {
        super(name); //1.执⾏⽗类Thread(String name)构造器，为当前线程设置名字了
    }

    @Override
    public void run() {
//2.currentThread() 哪个线程执⾏它，它就会得到哪个线程对象。
        Thread t = Thread.currentThread();
        for (int i = 1; i <= 3; i++) {
//3.getName() 获取线程名称
            System.out.println(t.getName() + "输出：" + i);
        }
    }
}
